function [H cost] = modelPrediction(Y, X, P, W)
%modelPrediction this function peform the prediction of the model using
%feature program parameters and model parameters optimized


%calculate the features
[FY, F] = featureProgram(Y, X, P);

%get the number of examples in the data set
M = size(F,1);

%add the intercepet term
F = [ones(M,1), F];

%make the linear prediction
H = F * W;

%calculate the cost
cost = (1/(2*M)) * ( sum((H - FY) .^ 2));

end

